<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.w3.org/1999/xhtml">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script type="text/javascript" src="../jQuery.js"></script>
</head>

<script>
    function paramesRule(){
        console.log("the name are :" +$("#name").val());
        if(name==null&&name==""){
            alert("This length has to be between 6 and 10 and not null not 空格");
        }else {
            $.ajax({
                url:"/testShiro/nameExist",
                type:"post",
                data:{
                    username:$("#name").val()
                },
                dataType : "html",
                success:function(data){
                    console.log("返回的数据："+data);
                        if (data!=null){
                            alert(data);
                        }
                }
            });

        }
    }

    // function paramesSizeAndNull() {
    //     var password=document.getElementById("paramesRule");
    //     if(password.length>6&&pass.length<10){
    //         alert("This length has to be between 6 and 10");
    //     }
    // }
    // function paramesSizeAndNull() {
    //     var password=document.getElementById("paramesRule");
    //     var passwordre=document.getElementById("yespasswr");
    //     if(password.length>6&&pass.length<10&&password.eq(passwordre)){
    //         alert("This length has to be between 6 and 10 and they have to be the same ");
    //     }
    // }
</script>
<body>
<h4 th:text="${msg}" style="color: red"></h4>
<form method="post" action="/testShiro/register">
    用户名: <input type="text" id="name" name="username" value="名字" onblur="paramesRule()"><br>
    密码:<input type="password" id="passwr" name="password" value="密码" onblur="paramesSizeAndNull()"><br>
    确认密码:<input type="password" id="yespasswr" name="reallypassword" value="确认密码" onblur="paramesSizeAndNull"><br>
    <input type="submit" value="提交">
</form>
</body>
</html>